
Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
eslint-plugin-no-only-tests
Advanced tools
The eslint-plugin-no-only-tests package is an ESLint plugin that helps developers avoid committing tests that are marked as 'only'. This is useful to ensure that all tests are run and none are accidentally skipped during continuous integration or other automated testing processes.
Disallow 'only' in test cases
This feature disallows the use of 'only' in test cases, which can be used to run a single test or a subset of tests. By setting this rule to 'error', any test cases that use 'only' will cause ESLint to throw an error, ensuring that all tests are run.
module.exports = {
"plugins": ["no-only-tests"],
"rules": {
"no-only-tests/no-only-tests": "error"
}
};
eslint-plugin-jest is an ESLint plugin for Jest testing framework. It includes a rule 'jest/no-focused-tests' that disallows the use of 'only' in test cases, similar to eslint-plugin-no-only-tests. However, eslint-plugin-jest offers a broader range of rules and configurations specifically for Jest.
eslint-plugin-mocha is an ESLint plugin for Mocha testing framework. It includes a rule 'mocha/no-exclusive-tests' that disallows the use of 'only' in test cases, similar to eslint-plugin-no-only-tests. This plugin is tailored for Mocha and provides additional rules for Mocha-specific best practices.
ESLint rule for .only
tests in mocha and other JS library tests.
Currently matches the following test blocks: describe
, it
, context
, tape
, test
First you'll need to install ESLint and the plugin:
npm install --save-dev eslint eslint-plugin-no-only-tests
# OR
yarn add --dev eslint eslint-plugin-no-only-tests
Note: If you installed ESLint globally (using the -g
flag) then you must also install eslint-plugin-no-only-tests
globally.
Add no-only-tests
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"no-only-tests"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"no-only-tests/no-only-tests": 2
}
}
FAQs
ESLint rule for .only blocks in mocha tests
The npm package eslint-plugin-no-only-tests receives a total of 977,450 weekly downloads. As such, eslint-plugin-no-only-tests popularity was classified as popular.
We found that eslint-plugin-no-only-tests demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.